﻿using Dimebrain.TweetSharp.Fluent;
using TweetSayingsLibrary.App.DataDoc;

namespace TweetSayingsLibrary.App.Entity
{
    public class Status
    {
        public static IDataDoc OnFriendsTimeline()
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnFriendsTimeline(), true);
        }

        public static IDataDoc OnFriendsTimeline(int page, int take)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnFriendsTimeline().Skip(page).Take(take), true);
        }

        public static IDataDoc OnHomeTimeline(int page, int take)
        {            
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnHomeTimeline().Skip(page).Take(take), true);
        }

        public static IDataDoc OnListTimeline(string screenName, string slug, int page, int take)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnListTimeline(screenName, slug).Skip(page).Take(take), true);
        }

        public static IDataDoc OnUserTimeline(int page, int take)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnUserTimeline().Skip(page).Take(take), true);
        }

        public static IDataDoc OnUserTimeline(int userId, int page, int take)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnUserTimeline().For(userId).Skip(page).Take(take), true);
        }

        public static IDataDoc OnUserTimeline(string screename, int page, int take)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnUserTimeline().For(screename.ToLower()).Skip(page).Take(take), true);
        }

        public static IDataDoc OnPublicTimeline()
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().OnPublicTimeline(), true);
        }

        public static IDataDoc Update(string text)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Update(text), false);
        }

        public static IDataDoc Update(string text, double latitude, double longitude)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Update(text, latitude, longitude), false);
        }

        public static IDataDoc Update(string text, long inReplyToStatusId)
        {
            if (inReplyToStatusId == 0)
                return Update(text);

            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Update(text).InReplyToStatus(inReplyToStatusId), false);
        }
        
        public static IDataDoc Update(string text, double latitude, double longitude, long inReplyToStatusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Update(text, latitude, longitude).InReplyToStatus(inReplyToStatusId), false);
        }

        public static IDataDoc Retweet(long statusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Retweet(statusId), true);
        }

        public static IDataDoc RetweetedByMe()
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().RetweetedByMe(), true);
        }

        public static IDataDoc RetweetedToMe()
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().RetweetedToMe(), true);
        }

        public static IDataDoc RetweetsOf(long statusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().RetweetsOf(statusId), true);
        }

        public static IDataDoc RetweetsOfMe(long statusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().RetweetsOfMe(), true);
        }

        public static IDataDoc Destroy(long statusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Destroy(statusId), false);
        }
    
        public static IDataDoc Show(long statusId)
        {
            return Current.SessionTrack.ApiCaller.Request(t => t.Statuses().Show(statusId), false);
        }
    }
}